﻿using System;
using System.Collections.Generic;
using kim.Common;
using System.Data;
using System.Text;

namespace kim.Web
{
    public partial class index : kim.UI.BasePage
    {
        protected string  strTet;
        protected string[] htmltext = new string[10];
        protected void Page_Load(object sender, EventArgs e)
        {
            BLL.siteconfig bll = new BLL.siteconfig();
            Model.siteconfig model = bll.loadConfig(Utils.GetXmlMapPath(KIMKeys.FILE_SITE_XML_CONFING));
            
            strTet = model.webtel;
            BindInfo();
            GetSlide();
        }

        private void GetSlide()
        {
            List<Model.Show> slideList = base.GetSlide(2, 1, 3);
            int i = 0;
            if (slideList.Count > 0)
            {
                foreach (Model.Show mo in slideList)
                {
                    htmltext[i] = "<a href=\"#\" class=\"mainBanner\" title=\"" + mo.Title + "\"> <img src=\"" + mo.Pic + "\" alt=\"" + mo.Title + "\" /></a>";

                    i++;

                }
            }
        }

        private void BindInfo()
        {
            rptCjwt.DataSource = new BLL.eg_news().GetModelList(8, "ClassID=1 and ChannelID=1", "Sort Desc");
            rptCjwt.DataBind();
            rptLqxy.DataSource = new BLL.eg_news().GetModelList(8, "ClassID=1 and ChannelID=3", "Sort Desc");
            rptLqxy.DataBind();
            rptJnzc.DataSource = new BLL.eg_news().GetModelList(8, "ClassID=2 and ChannelID=7", "Sort Desc");
            rptJnzc.DataBind();
            rptZszs.DataSource = new BLL.eg_news().GetModelList(8, "ClassID=1 and ChannelID=6", "Sort Desc");
            rptZszs.DataBind();
            rptZkxy.DataSource = new BLL.eg_news().GetModelList(8, "ClassID=3 and ChannelID=5", "Sort Desc");
            rptZkxy.DataBind();
            rptXxzs.DataSource = new BLL.eg_news().GetModelList(20, "ClassID=2 and ChannelID=3", "Sort Desc");
            rptXxzs.DataBind();
            IList<kim.Model.CClass> CClassList = base.GetTopClass(1, 3);
            if (CClassList.Count > 0)
            {
                rptZkdt.DataSource = new BLL.Product().GetList(6, "ClassID=" + CClassList[0].ID, "Sort Desc");
                rptZkdt.DataBind();
            }
            

        }


        protected string GetNewListView(int top, int typeidx, int fidx)
        {
            string SlideText = string.Empty;
            List<Model.eg_news> slide = new BLL.eg_news().GetModelList(top, "ClassID=" + typeidx + " and ChannelID=" + fidx, "Sort Desc");
            
            int i = 1;
            if (slide.Count > 0)
            {
                foreach (Model.eg_news show in slide)
                {
                    SlideText+="<li>";
                    SlideText += "<a href=\"newsDetails.aspx?fid=" + show.ChannelID + "&id=" + show.ID + "\" title=\"" + show.Name + "\">" + show.Name + "</a> ";
                    SlideText += " <span>"+((DateTime)show.InTime).ToString("yyyy-MM-dd")+"</span>";
                    SlideText += "</li>";
                    i++;
                }

            }
            return SlideText;
        }
    }
}